package com.pansoft.hd;

/**
 * bip44协议的一些常用路径
 *
 * @author yqs
 */
public class BIP44Util {

    //BIP44则是为这个路径约定了一个规范的含义(也扩展了对多币种的支持)，BIP0044指定了包含5个预定义树状层级的结构：
    //m / purpose' / coin' / account' / change / address_index

    /**
     * 比特币主网
     */
    public final static String BITCOIN_MAINNET_PATH = "M/44H/0H/0H";
    /**
     * 比特币测试网
     */
    public final static String BITCOIN_TESTNET_PATH = "M/44H/1H/0H";
    /**
     * 比特币隔离见证主网（会生成3开头的地址）
     */
    public final static String BITCOIN_SEGWIT_MAIN_PATH = "M/49H/0H/0H";
    /**
     * 比特币隔离见证测试网
     */
    public final static String BITCOIN_SEGWIT_TESTNET_PATH = "M/49H/1H/0H";

    /**
     * ETH account PATH
     */
    public final static String ETH_ACCOUNT_PATH = "M/44H/60H/0H";
    /**
     * ETE account PATH
     */
    public final static String ETE_ACCOUNT_PATH = "M/44H/60H/136H";


    /**
     * ETH
     */
    public final static String ETHEREUM_PATH = "M/44H/60H/0H/0/0";
    /**
     * ETE
     */
    public final static String ETE_PATH = "M/44H/60H/136H/0/0";


    public final static String EOS_PATH = "M/44H/194H";
    public final static String EOS_SLIP48 = "M/48H/4H/0H/0H/0H,m/48H/4H/1H/0H/0H";
    public final static String EOS_LEDGER = "M/44H/194H/0H/0/0";


//    /**
//     * 生成层级
//     *
//     * @param path bipPath
//     */
//    public static ImmutableList<ChildNumber> parsePath(String path) {
//        List<ChildNumber> list = new ArrayList<>();
//        for (String p : path.split("/")) {
//            if ("m".equalsIgnoreCase(p) || "".equals(p.trim())) {
//                continue;
//            } else if (p.charAt(p.length() - 1) == 'H') {
//                list.add(new ChildNumber(Integer.parseInt(p.substring(0, p.length() - 1)), true));
//            } else {
//                list.add(new ChildNumber(Integer.parseInt(p), false));
//            }
//        }
//
//        ImmutableList.Builder<ChildNumber> builder = ImmutableList.builder();
//        return builder.addAll(list).build();
//    }

}
